home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / A_Fast_Ric2064945102007.psc / SOLO SyntaxControl / Form1.frm next >
Text File  |  2007-05-10  |  7KB  |  189 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Syntax Highlighting Control (RichTextBox)"
  5.    ClientHeight    =   6465
  6.    ClientLeft      =   45
  7.    ClientTop       =   360
  8.    ClientWidth     =   8235
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   6465
  13.    ScaleWidth      =   8235
  14.    StartUpPosition =   2  'CenterScreen
  15.    Begin VB.CommandButton Command2 
  16.       Caption         =   "Visit my Website (Clik Here)"
  17.       Height          =   375
  18.       Left            =   150
  19.       TabIndex        =   5
  20.       Top             =   5970
  21.       Width           =   6645
  22.    End
  23.    Begin VB.CommandButton Command1 
  24.       Caption         =   "Close"
  25.       Height          =   375
  26.       Left            =   6870
  27.       TabIndex        =   4
  28.       Top             =   5970
  29.       Width           =   1215
  30.    End
  31.    Begin Project1.SOLO_RTBSyntax SOLO_RTBSyntax1 
  32.       Height          =   5235
  33.       Left            =   120
  34.       TabIndex        =   0
  35.       Top             =   660
  36.       Width           =   7965
  37.       _ExtentX        =   14049
  38.       _ExtentY        =   9234
  39.       BorderStyle     =   0
  40.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  41.          Name            =   "Courier New"
  42.          Size            =   9.75
  43.          Charset         =   0
  44.          Weight          =   400
  45.          Underline       =   0   'False
  46.          Italic          =   0   'False
  47.          Strikethrough   =   0   'False
  48.       EndProperty
  49.       MouseIcon       =   "Form1.frx":0000
  50.       RightMargin     =   1.00000e5
  51.       ColorOf_ProceduresORFunctions=   33023
  52.    End
  53.    Begin VB.Label Label2 
  54.       AutoSize        =   -1  'True
  55.       BackStyle       =   0  'Transparent
  56.       Caption         =   "Please Vote!"
  57.       BeginProperty Font 
  58.          Name            =   "Verdana"
  59.          Size            =   9.75
  60.          Charset         =   0
  61.          Weight          =   700
  62.          Underline       =   0   'False
  63.          Italic          =   0   'False
  64.          Strikethrough   =   0   'False
  65.       EndProperty
  66.       ForeColor       =   &H000000C0&
  67.       Height          =   240
  68.       Left            =   120
  69.       TabIndex        =   6
  70.       Top             =   360
  71.       Width           =   1380
  72.    End
  73.    Begin VB.Label Label5 
  74.       AutoSize        =   -1  'True
  75.       BackStyle       =   0  'Transparent
  76.       Caption         =   "http://www.solosoftware.co.nr"
  77.       ForeColor       =   &H00FF0000&
  78.       Height          =   195
  79.       Left            =   5970
  80.       TabIndex        =   3
  81.       Top             =   120
  82.       Width           =   2160
  83.    End
  84.    Begin VB.Label Label4 
  85.       AutoSize        =   -1  'True
  86.       BackStyle       =   0  'Transparent
  87.       Caption         =   "solo_sevensix@yahoo.com"
  88.       ForeColor       =   &H00FF0000&
  89.       Height          =   195
  90.       Left            =   6150
  91.       TabIndex        =   2
  92.       Top             =   360
  93.       Width           =   1935
  94.    End
  95.    Begin VB.Label Label1 
  96.       AutoSize        =   -1  'True
  97.       BackStyle       =   0  'Transparent
  98.       Caption         =   "A Syntax Highlighting Control by: Solomonn R. Manalo"
  99.       BeginProperty Font 
  100.          Name            =   "Verdana"
  101.          Size            =   8.25
  102.          Charset         =   0
  103.          Weight          =   400
  104.          Underline       =   0   'False
  105.          Italic          =   0   'False
  106.          Strikethrough   =   0   'False
  107.       EndProperty
  108.       Height          =   195
  109.       Left            =   120
  110.       TabIndex        =   1
  111.       Top             =   120
  112.       Width           =   4680
  113.    End
  114. End
  115. Attribute VB_Name = "Form1"
  116. Attribute VB_GlobalNameSpace = False
  117. Attribute VB_Creatable = False
  118. Attribute VB_PredeclaredId = True
  119. Attribute VB_Exposed = False
  120. '==========================================================
  121. ' An RTB Syntax Highlighting Control.
  122. ' Made by solomon manalo
  123. '==========================================================
  124.  
  125. Option Explicit
  126.  
  127. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  128. Dim ex As String
  129.  
  130. Function ReadTextFileContents(filename As String) As String
  131.     Dim fnum As Integer, isOpen As Boolean
  132.     On Error GoTo Error_Handler
  133.     ' Get the next free file number.
  134.     fnum = FreeFile()
  135.     Open filename For Input As #fnum
  136.     ' If execution flow got here, the file has been open without error.
  137.     isOpen = True
  138.     ' Read the entire contents in one single operation.
  139.     ReadTextFileContents = Input(LOF(fnum), fnum)
  140.     ' Intentionally flow into the error handler to close the file.
  141. Error_Handler:
  142.     ' Raise the error (if any), but first close the file.
  143.     If isOpen Then Close #fnum
  144.     If Err Then Err.Raise Err.Number, , Err.Description
  145. End Function
  146.  
  147. Private Sub Command1_Click()
  148. Unload Me: End
  149. End Sub
  150.  
  151. Private Sub Command2_Click()
  152. OpenURL "http://www.solosoftware.co.nr", Me.hWnd
  153. End Sub
  154.  
  155. Private Sub Form_Load()
  156. Dim nL As String
  157. Call InitSyntaxEditor
  158. SOLO_RTBSyntax1.Text = ReadTextFileContents(App.Path & "\Sample.txt")
  159. Call InitSyntaxEditor
  160. End Sub
  161.  
  162. Public Sub InitSyntaxEditor()
  163. 'You can change the Deafult syntax colors of this control by its
  164. 'properties in design time, or in coding style.
  165. With SOLO_RTBSyntax1
  166. 'Try to Uncomment this code...
  167. '===================================================
  168. '     .ColorOf_ReservedWords = vbRed
  169. '     .ColorOf_ProceduresORFunctions = vbBlue
  170. '     .ColorOf_Comments = vbYellow
  171. '     .ColorOf_Strings = vbGreen
  172. '===================================================
  173.      .Syntax_CommentChar = CommentCharacter
  174.      .Syntax_StringChar = StringCharacter
  175.      .Syntax_Delimiter = SplittingCharacter
  176.      .Syntax_Operators = Operators
  177.      .Syntax_LogicalOperators = LOperators
  178.      .Syntax_ReservedWords = RESERVED
  179.      .Syntax_ProceduresORFunctions = FUNC_OBJ
  180.      'Refreshes the syntax coloring always call this property
  181.      'when there is change in Syntaxes or Colors
  182.      .ReColorize
  183.      End With
  184. End Sub
  185.  
  186. Public Function OpenURL(urlADD As String, sourceHWND As Long)
  187.      Call ShellExecute(sourceHWND, vbNullString, urlADD, "", vbNullString, 1)
  188. End Function
  189.